# -*- coding: utf-8 -*-
# author yzs
# date 2018-12-17
#
# 按数值个数排序
# Description
# Given an array of integers, sort the array according to frequency of elements.
# For example, if the input array is {2, 3, 2, 4, 5, 12, 2, 3, 3, 3, 12},
# then modify the array to {3, 3, 3, 3, 2, 2, 2, 12, 12, 4, 5}.
# If frequencies of two elements are same, print them in increasing order.
# Input
# The first line of input contains an integer T denoting the number of test cases.
# The description of T test cases follows. The first line of each test case contains a single integer N
# denoting the size of array. The second line contains N space-separated integers A1, A2, ..., AN
# denoting the elements of the array.（1 ≤ T ≤ 70；30 ≤ N ≤ 130；1 ≤ A [ i ] ≤ 60 ）
# Output
# Print each sorted array in a seperate line. For each array its numbers should be seperated by space.
# Sample Input 1 
# 1
# 5
# 5 5 4 6 4
# Sample Output 1
# 4 4 5 5 6


appear_time = [0] * 61


def merge(left, right):
    result = []
    while len(left) > 0 and len(right) > 0:
        if appear_time[left[0]] >= appear_time[right[0]]:
            result.append(left.pop(0))
        else:
            result.append(right.pop(0))
    result += left
    result += right
    return result


def merge_sort(lists):
    if len(lists) <= 1:
        return lists
    middle = int(len(lists) / 2)
    left = merge_sort(lists[:middle])
    right = merge_sort(lists[middle:])
    return merge(left, right)


def initial_array(array):
    for i in array:
        appear_time[i] += 1


def sort_by_value(array):
    initial_array(array)
    sort_list = []
    for i in range(61):
        if appear_time[i] != 0:
            sort_list.append(i)
    result = merge_sort(sort_list)
    for m in result:
        for n in range(appear_time[m]):
            print(m, end=' ')
    print()


T = int(input().strip())
for i in range(T):
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    A = A[:N]
    sort_by_value(A)
